package org.example.completed.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.example.completed.domain.AdoptionRecord;
import org.example.completed.mapper.AdoptionRecordMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.completed.service.AdoptionRecordService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2025-04-07
 */
@Service
public class AdoptionRecordServiceImpl extends ServiceImpl<AdoptionRecordMapper, AdoptionRecord> implements AdoptionRecordService {
    @Override
    public List<AdoptionRecord> getRecordsByUserId(String userId) {
        QueryWrapper<AdoptionRecord> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public List<AdoptionRecord> getRecordsByPetId(String petId) {
        QueryWrapper<AdoptionRecord> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("pet_id", petId);
        return baseMapper.selectList(queryWrapper);
    }

}
